<template>
	<view>
		<map style="width: 100%; height: 1400rpx;" :latitude="latitude" :longitude="longitude" 
		:markers="convers" scale=10 @markertap="openLamp">
		  </map>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				latitude:22.618813565184746,
				longitude:113.05628099361725,
				convers:[
				]
			}
		},
		methods: {
			openLamp:function(e){
				//h5
				//let id = e.detail.markerId;
				//小程序
				let id = e.markerId;
				for(let lamp of this.$lamps.data.list){
					if(lamp.id === id){
						uni.navigateTo({
						    url: '../lamp/lamp?code='+lamp.code+'&name='+lamp.name,
						});
					}
				}
			}
		},
		mounted() {
		},
		onShow() {
			this.convers=[];
			for(let lamp of this.$lamps.data.list){
				console.log(lamp.longitude)
				this.convers.push({
					id:lamp.id,
					longitude:lamp.longitude,
					latitude:lamp.latitude,
				})
			}
		}
	}
</script>

<style>

</style>
